package com.neshai.webapp.controller;

import com.neshai.webapp.service.UsageService;
import com.neshai.webapp.utils.R;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.*;

@Log4j2
@RestController
@RequestMapping({"/api"})
//@RequiredArgsConstructor 是 Lombok 提供的一个注解，用于自动生成包含所有 final 字段和带有 @NonNull 注解的字段的构造函数。
@RequiredArgsConstructor
public class YoloController {

    private final UsageService usageService;

    @PostMapping(value = "/yolo/task")
    public R streamCompletionsPost( HttpServletRequest request) {
        usageService.usePremiumService(Integer.parseInt((String) request.getAttribute("id")));
        return R.success("success");
    }
}
